import user from '@/store/modules/user.js'

// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	modules: {
		user
	},
	strict: true,
	state: {
		num: 100,
		totalPrice: 0,
		addressId: '',
		goodsIds: [],
		shoppingCartListIds: [],
		orders: [],
		orderGoodsList: []
	},
	mutations: {
		setGoodsIds(state, goods) {
			state.goodsIds = goods
		},
		setTotalPrice(state, price) {
			state.totalPrice = price
		},
		setAddressId(state, addr) {
			state.addressId = addr
		},
		setShoppingCartListIds(state, list) {
			state.shoppingCartListIds = list
		},
		setOrders(state, list) {
			state.orders = list
		},
		setOrderGoodsList(state, list) {
			state.orderGoodsList = list
		},
	}
})
// #endif

// #ifdef VUE3
import {
	createStore
} from 'vuex'
const store = createStore({
	modules: {
		user
	},
	state: {
		num: 100
	}
})
// #endif

export default store
